package org.czl.gh;

public class l600 {
    public static void main(String[] args) {
        System.out.println(findIntegers(4));
    }
    static int offset;
    public static int findIntegers(int n) {
        offset = Integer.SIZE - Integer.numberOfLeadingZeros(n);
        return f(0, false);
    }
    static int f(int index, boolean isLimited){
        if(index == offset){
            return 1;
        }
        int ans = 0;
        if(isLimited){
            ans += f(index + 1, false);
        }else{
            ans += f(index + 1, true);
            ans += f(index + 1, false);
        }
        return ans;
    }
}
